//
// Created by yewei on 2023/1/4.
//
#include <bits/stdc++.h>

using namespace std;

struct node{
    double r;
    double h;
};

bool cmp(node a,node b){
    return a.r*a.r+2*a.r*a.h >= b.r*b.r+2*b.r*b.h;
}
int main() {
    freopen("../input.txt", "r", stdin);
    int n,k;
    cin>>n>>k;
    struct node node[n];
    for(int i=0;i<n;i++) cin>>node[i].r>>node[i].h;
    sort(node,node+n,cmp);
    double max_r=0,cmj=0,dmj=0;
    for(int i=0;i<k;i++){
        cmj += 2*node[i].r*node[i].h;
        if(node[i].r>max_r) max_r = node[i].r;
    }
    dmj = max_r*max_r;
    cout<<cmj+dmj<<endl;
}
